home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-02
/
pwfosl10.zip
/
PWFOSSIL.DOC
< prev
next >
Wrap
Text File
|
1992-04-01
|
17KB
|
490 lines
PWFOSSIL
A unit designed to make FOSSIL communications easier.
Written for Turbo Pascal 6.0
by
Jody Burrow
Patchwork Software Development
Copyright Notice
----------------
This document and all included programs and files are Copyright
(c) 1992 by Patchwork Software Development. All rights are
hereby reserved.
Trademark Acknowledgements
--------------------------
Turbo Pascal is a registered trademark of Borland International.
IBM PC/XT/AT and PC-DOS are registered trademarks of
International Business Machines.
MS-DOS is a registered trademark of Microsoft, Inc.
X00.SYS is a trademark of Raymond L. Gwinn.
BNU.COM is a trademark of David Nugent and Unique Computing Pty
Ltd.
Table of Contents
-----------------
Copyright Notice . . . . . . . . . . . . . . . . . . . . . . . ii
Trademark Acknowledgements . . . . . . . . . . . . . . . . . . ii
Table of Contents. . . . . . . . . . . . . . . . . . . . . . .iii
Registration . . . . . . . . . . . . . . . . . . . . . . . . . iv
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 1
Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
CarrierDetect . . . . . . . . . . . . . . . . . . . . . . 2
DeInitFossil. . . . . . . . . . . . . . . . . . . . . . . 3
DTRRaise. . . . . . . . . . . . . . . . . . . . . . . . . 4
FlushOutput . . . . . . . . . . . . . . . . . . . . . . . 5
InitFossil. . . . . . . . . . . . . . . . . . . . . . . . 6
InputCheck. . . . . . . . . . . . . . . . . . . . . . . . 7
PurgeInput. . . . . . . . . . . . . . . . . . . . . . . . 8
PurgeOutput . . . . . . . . . . . . . . . . . . . . . . . 9
Reboot. . . . . . . . . . . . . . . . . . . . . . . . . . 10
RecvChar. . . . . . . . . . . . . . . . . . . . . . . . . 11
SetBaud . . . . . . . . . . . . . . . . . . . . . . . . . 12
SetFlowControl. . . . . . . . . . . . . . . . . . . . . . 13
SetWatch. . . . . . . . . . . . . . . . . . . . . . . . . 14
SendChar. . . . . . . . . . . . . . . . . . . . . . . . . 15
SendString. . . . . . . . . . . . . . . . . . . . . . . . 16
Registration
------------
PWFOSSIL is a shareware product. This means that you are
required to register it with the author if you are still using it
after a trial period of 30 days. You may not distribute software
written with it without registering the product. A short message
will be shown on the screen upon initialization of the unit.
Registering will remove this message as well as entitling you to
receive the source code for this unit.
This program is provided "AS IS" without any kind of warranty.
Please note that Patchwork Software development is not
responsible for any damages this program causes and that you
assume all responsibility for the use of this program. The
entire risk of quality, suitability, and performance is left up
to you, the user.
Registration is a very minimal fee for this product. It is only
$7.50 for 5.25" disks and $10.00 for 3.5" disks. To register,
send a check made out to Jody Burrow and the completed
REGISTER.FRM in the distribution package to the following
address:
Jody Burrow
Patchwork Software Development
1611 E. Lark
Springfield, MO
65804-4351
You will receive your registered copy and source code in the US
Mail within 2 weeks.
With any software you create with the registered copy, you are
free to distribute it however you choose. We request however
that somewhere either on the title screen of the program or in
the documentation you put in the following line:
FOSSIL routines provided by Patchwork Software's PWFOSSILIntroduction
------------
Patchwork FOSSIL Interface (PWFOSSIL) is a unit written for Turbo
Pascal 6.0 developed for the purpose of easing the use of FOSSIL
drivers such as BNU.COM or X00.SYS. Communication programs often
use these routines to communicate with devices such as modems. I
created this unit to ease my development of some software which
heavily accessed the communication ports on my PC.
To use this unit requires the following:
* IBM PC/XT/AT or compatible machine running MS or PC-DOS
* Turbo Pascal 6.0 (earlier versions will not work!)
* A FOSSIL driver (X00.SYS and BNU.COM are good ones)
The following pages will go into detail describing each command
written in this unit. The format will be as follows:
Name:*******************
Type:*******************
Syntax:*****************
Returns:****************
Description:************
Example:****************
Examples will be given on each command to aid the user in fully
understanding the command.
All commands are listed in alphabetical order. In no way does
this imply that this is the order in which you must call them.
If there are any questions concerning this unit, you may reach me
by phone at 1-417-881-5097, by FidoNET net-mail at 1/284:13, or
by mail at the address listed in the registration section.
Hope you enjoy this unit, and please don't forget to register.
Registration will help aid the development of other great
products from Patchwork Software Development.
Commands
--------
Name: CarrierDetect
Type: Function
Syntax: CarrierDetect(port: integer);
port = COM port number
Returns: boolean variable
TRUE = Carrier is detected
FALSE = NO Carrier is detected
Description: This function tells whether or not the modem shows
that carrier is detected. It returns the state of
the carrier as a boolean variable. You must pass
the function your COM port number as an integer
type, i.e. COM1 is 1, COM2 is 2, etc.
Example: var
result: boolean
begin
result:=CarrierDetect(1);
if result=TRUE then
writeln('Carrier is detected)
else
writeln('Carrier is NOT detected);
end.
Name: DeInitFossil
Type: procedure
Syntax: DeInitFossil(port: integer);
port = COM port number
Returns: none
Description: This is used to end all communication functions with
the driver. When you are finished using the FOSSIL
driver, it is recommended that you call this
function. Please note that DTR is not affected by
this call.
Example: begin
DeInitFossil(1);
Writeln('FOSSIL is now closed!');
end.
Name: DTRRaise
Type: procedure
Syntax: DTRRaise(port: integer; raise: boolean);
port = COM port number
raise = DTR state desired
Returns: none
Description: This procedure changes the state of the modem's DTR
line. Passing a FALSE in the raise parameter lowers
DTR and disables the modem. Passing a TRUE in the
raise parameter raises DTR and enables the modem.
This procedure is useful for hanging up the modem.
Example: begin
DTRRaise(1,TRUE);
Writeln('The modem is enabled!');
DTRRaise(1,FALSE);
Writeln('The modem is disabled!');
end.
Name: FlushOutput
Type: procedure
Syntax: FlushOutput(port: integer);
port = COM port number
Returns: none
Description: This procedure takes all output in the
communications buffer and forces it to be sent out.
Note that using this routine with flow control can
cause your machine to hang under certain
circumstances.
Example: begin
FlushOutput(1);
Writeln('All output has been flushed!');
end;
Name: InitFossil
Type: function
Syntax: InitFossil(port: integer);
port = COM port number
Returns: success: boolean
Description: This routine must be called before any other FOSSIL
related routines in this unit are called. This
opens the FOSSIL driver for the specified port. It
returns a boolean value determining the success of
the opening operation. TRUE is returned if
successful, FALSE is returned if unsuccessful.
Example: var
success: boolean
begin
success:= InitFossil(1);
If success = TRUE
writeln('FOSSIL opened successfully!')
else
writeln('FOSSIL not opened successfully!');
end.
Name: InputCheck
Type: function
Syntax: InputCheck(port: integer);
port = COM port number
Returns: available: boolean
Description: This function checks whether or not characters are
available in the communications input buffer. If
characters are available, the function returns TRUE
as a boolean. Otherwise it returns a FALSE.
Example: var
available: boolean
begin
available: InputCheck(1);
if available:= TRUE then
writeln('Characters are available!')
else
writeln('No characters are available!');
end.
Name: PurgeInput
Type: procedure
Returns: none
Syntax: PurgeInput(port: integer);
port = COM port number
Description: This procedure removes all pending data from the
communication input buffer which effectively clears
it.
Example: begin
PurgeInput(1);
writeln('All input data has been cleared!');
end.
Name: PurgeOutput
Type: procedure
Returns: none
Syntax: PurgeOutput(port: integer);
port = COM port number
Description: This operates similar to the PurgeInput routine
except that it clears the output buffer. Note that
the data in the output buffer is not sent before the
clear!
Example: begin
PurgeOutput(1);
writeln('No output data is left in the buffer!');
end.
Name: Reboot
Type: procedure
Returns: none
Syntax: Reboot(type: boolean);
type = Type of reboot
TRUE = warm boot
FALSE = cold boot
Description: Using this procedure will cause a total reboot of
your system. It will either perform a warm reboot,
or a cold reboot which will start the system from
scratch. Use this procedure with caution.
Example: begin
writeln('A warm reboot will occur!');
Reboot(TRUE);
end.
- or -
begin
writeln('A cold reboot will occur!');
reboot(FALSE);
end.
Name: RecvChar
Type: function
Returns: status: boolean
TRUE = characters available
FALSE = characters not available
Syntax: RecvChar(port: integer; var charrecv: char)
port = COM port number
charrecv = character received from buffer
Description: This routine gets characters from the FOSSIL's input
buffer. The character is placed in the character
type variable passed by you to the function in the
parameter section. The function returns a variable
which states whether or not characters are available
to be received.
Example: var
status: boolean;
ch: char;
begin
status:= RecvChar(1, ch);
if status=TRUE then Writeln('The character
received is '; ch)
else writeln('No character available!');
end.
Name: SetBaud
Type: procedure
Syntax: SetBaud(baud: word; port, stopbit, charlen: integer;
p: parity);
baud = baud rate of port (300, 600, 1200, 2400,
4800, 9600, 19200, 38400
supported)
port = COM port number
stopbit = number of stop bits (1 and 2 supported)
charlen = character length (5, 6, 7, 8 supported)
parity = type of parity (none, even, odd
supported)
Returns: none
Description: This procedure sets the baud rate and other
communications parameters required of the FOSSIL.
If invalid parameters are passed to the procedure,
it will print an error message and end the program
entirely, therefore make sure the parameters you
send are correct!
Example: begin
SetBaud(2400, 1, 1, 8, none);
Writeln('This sets COM1: for 2400,N,8,1!');
end;
Name: SetFlowControl
Type: procedure
Syntax: SetFlowControl(port: integer, STran, Hard, SRecv:
boolean);
port = COM port number
STran = XON/XOFF software on transmit only
Hard = CTS/RTS hardware
SRecv = XON/XOFF software on receive only
TRUE turns it on -> on above
FALSE turns it off -> three only
Returns: none
Description: This sets the type(s) of flow control that the
FOSSIL and the communications port will use. Most
high speed communications will require some type to
be used depending on the application. Consult your
modem's documentation for more information on flow
control.
Example: begin
SetFlowControl(1, TRUE, FALSE, TRUE);
writeln('only software flow control is on!');
end.
Name: SetWatch
Type: procedure
Syntax: SetWatch(port: integer; state: boolean);
port = COM port number
state = state of carrier watchdog
TRUE = on
FALSE = off
Returns: none
Description: This procedure turns on and off the carrier
watchdog. With it on, the system will reboot when
carrier is lost no matter what. Passing a TRUE in
the state parameter turns it on, FALSE turns it off.
Example: begin
SetWatch(1, TRUE);
writeln('Watchdog is on!');
SetWatch(1,FALSE);
writeln('Watchdog is off!');
end.
Name: SendChar
Type: procedure
Syntax: SendChar(port: integer; ch: char);
Returns: none
Description: This procedure sends a character to the specified
communications port. Nothing is added to the
character, it is sent just as given.
Example: begin
SendChar(1, 'C');
Writeln ('The character C was sent.');
end.
Name: SendString
Type: procedure
Syntax: SendString(port: integer; st: string);
Returns: none
Description: This procedure sends a string to the specified
communications port. The string can be a maximum of
255 characters long (a pascal limit). No
translation is made or other characters are added to
the string, It is sent as given.
Example: begin
SendString(1, 'Hello!');
writeln('The string Hello! was sent.');
end;